<%@ Page Title="Pay_Records List" Language="C#" AutoEventWireup="true" CodeBehind="Pay_RecordsList.aspx.cs" Inherits="Youz.CreditRepay.Manage.Pay_RecordsList" %><script>
    //loadCSS("assets/plugins/gritter/css/jquery.gritter.css");

    var requireJS = [
        //"assets/plugins/gritter/js/jquery.gritter.min.js"
    ];

    loadJS(requireJS);
</script>
<div class="row"><div class="col-lg-12"><div class="panel panel-default"><div class="panel-heading" data-original-title><h2><i class="fa fa-align-justify"></i><span class="break"></span><%: R(LanguageModule.Pay_Records, "Pay_Records", "Pay_Records") %></h2><div class="panel-actions"></div></div><div class="panel-body"><div class="alert alert-danger" style="display: none;"><button type="button" class="close" data-dismiss="alert">×</button><strong><i class="fa fa-warning"></i></strong><span class="content"></span></div><div class="col-sm-4"><div class="form-group"><div class="input-group"><input type="email" id="input2-group2" name="input2-group2" class="form-control" placeholder="Search..."><span class="input-group-btn"><button type="button" class="btn btn-primary"><i class="fa fa-search "></i>
								<%: R(LanguageModule.M_Common, "Query") %></button></span></div></div></div><div class="col-sm-12"><div class="form-group">
					<a href="#" class="btn btn-info" onclick="loadPage('Pay/Pay_RecordsItem.aspx')"><i class="fa fa-plus"></i>
						<%: R(LanguageModule.M_Common, "Add") %></a>
							<a href="#" class="btn btn-info" id="btnEdit"><i class="fa fa-edit "></i>
						<%: R(LanguageModule.M_Common, "Edit") %></a>
							<a href="#" class="btn btn-info" id="btnDelete"><i class="fa fa-trash-o "></i>
						<%: R(LanguageModule.M_Common, "Delete") %></a>
							<a href="#" class="btn btn-info" onclick="addMember()"><i class="fa fa-user"></i>
						<%: R(LanguageModule.Pay_Records, "ManageMember") %></a>
							</div></div><table id="table" class="table table-striped table-bordered dt-responsive nowrap" cellspacing="0" width="100%"></table></div></div></div></div>
<script type="text/javascript">
      var dt;
      
      $(function () {

        dt = $('#table').DataTable({
            "ajax": {
                "url": 'Pay/Handlers/Pay_RecordsHandler.ashx?type=list',
                "type": "POST",
                "dataSrc": "data",
                "data": function (d) {
                }
            },
            "columns": [                
                	
                    { "data": 'ID', "title": "<%: R(LanguageModule.Pay_Records, "ID", "ID") %>",visible:false },	
                    { "data": 'PayType', "title": "<%: R(LanguageModule.Pay_Records, "PayType", "PayType") %>",render:fnumber },	
                    { "data": 'TradeNo', "title": "<%: R(LanguageModule.Pay_Records, "TradeNo", "TradeNo") %>" },	
                    { "data": 'TradeTime', "title": "<%: R(LanguageModule.Pay_Records, "TradeTime", "TradeTime") %>" },	
                    { "data": 'TradeName', "title": "<%: R(LanguageModule.Pay_Records, "TradeName", "TradeName") %>" },	
                    { "data": 'Payer', "title": "<%: R(LanguageModule.Pay_Records, "Payer", "Payer") %>" },	
                    { "data": 'Amount', "title": "<%: R(LanguageModule.Pay_Records, "Amount", "Amount") %>",render:fmoney },	
                    { "data": 'Status', "title": "<%: R(LanguageModule.Pay_Records, "Status", "Status") %>",render:fnumber },	
                    { "data": 'CreateTime', "title": "<%: R(LanguageModule.Pay_Records, "CreateTime", "CreateTime") %>" },	
                    { "data": 'ModifyTime', "title": "<%: R(LanguageModule.Pay_Records, "ModifyTime", "ModifyTime") %>" },
            ]
        });

        //delete selected row
        $('#btnDelete').click(function () {
            if ($('#table tbody tr.selected').length > 0) {
                jconfirm("<%: R(LanguageModule.M_Common, "DeleteConfirm") %>", function () {
                    //console.log(dt.row('.selected').data());
                    $.post("Pay/Handlers/Pay_RecordsHandler.ashx?type=delete<%: WebHelper.Get("st") %>", { ID: dt.row('.selected').data().ID }, function (data) {
                        if (data) {
                            if (data.isSuccess) {
                                dt.ajax.reload();

                                $.gritter.add({
                                    title: '<%: R(LanguageModule.M_Common, "TipSuccess") %>',
                                    text: data.message,
                                    class_name: 'gritter-success'
                                });

                                $('#table tbody tr.selected').remove();
                            }
                        }
                    }, "json");
                });
            }
            else {
                $(".alert > .content").html("<%: R(LanguageModule.M_Common, "SelectRecord") %>");
                $(".alert").show();
            }
        });

        //delete selected row
        $('#btnEdit').click(function () {
            if ($('#table tbody tr.selected').length > 0) {
                loadPage("Pay/Pay_RecordsItem.aspx?ID=" + dt.row('.selected').data().ID);
            }
            else {
                $(".alert > .content").html("<%: R(LanguageModule.M_Common, "SelectRecord") %>");
                $(".alert").show();
            }
        });

    });
</script>